<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <!-- Standard Meta -->
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <!-- Site Properties -->
    <title>搜索 | Any Video</title>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <link href="https://cdn.bootcss.com/semantic-ui/2.2.10/semantic.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/semantic-ui/2.2.10/semantic.min.js"></script>
    <link href="/css/style.css" rel="stylesheet">
    <script src="/js/siderbar.js"></script>
</head>

<body>

<div th:replace="~{header :: fmenu}"></div>

<div th:replace="~{header :: smenu}"></div>

<div class="pusher">

    <div th:replace="~{header :: pmenu}"></div>

    <div class="nav-divider"></div>

    <div class="ui center aligned text container">
        <div class="ui action left icon fluid input">
            <i class="search icon"></i>
            <input type="text" placeholder="搜索..." id="searchInput">
            <div class="ui teal button" id="searchBtn">搜索</div>
        </div>

    </div>

    <div class="ui horizontal divider hidden"></div>

    <div class="ui text container" th:if="${hasResult}">
        <div class="row">
            <h2 class="ui dividing header teal">
                <i class="cloud icon item"></i>
                共 [[${size}]] 条记录
            </h2>
        </div>

        <div class="ui divided items">
            <div class="item" th:each="video : ${videos}">
                <div class="ui tiny image">
                    <img th:src="${video.image}">
                </div>
                <a class="middle aligned content" th:href="@{/view(u=${video.value})}" th:text="${video.title}"> </a>
            </div>
        </div>

        <div class="ui horizontal divider hidden"></div>
    </div>
</div>

<script>
    $('#searchBtn').click(function () {
        var content = $('#searchInput').val();
        if (content.length < 1)
            return -1;
        window.location.href = '/search?wd=' + content;
    });
</script>
</body>

</html>